#include <iostream>
#include <memory>
#include <sstream>
#include<jsoncpp/json/json.h>
using namespace std;
using namespace Json;
int main()
{
    const char* name="joe";
    int age=10;
    int score[]={11,12,13};
    Json::Value val;
    val["name"]=name;
    val["age"]=age;
    val["mark"].append(score[0]);
    val["mark"].append(score[1]);
    val["mark"].append(score[2]);
    Json::StreamWriterBuilder swb;
    unique_ptr<StreamWriter>sw(swb.newStreamWriter());
    stringstream ss;
    int ret=sw->write(val,&ss);
    if(ret!=0)
    {
        cout<<"write failed!"<<endl;
        return -1;
    }
    cout<<ss.str()<<endl;
    return 0;
}